layui.use(['form','layedit'], function () {
    var $ = layui.jquery,layedit = layui.layedit,form = layui.form;
    var msg = $("#msg").val();
    if ("" != msg) {
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.msg(msg);
        parent.layer.close(index);
    }
    form.on("checkbox(section1)", function (data) {
        var val = $("input[name='xzx']").val();
        var content = $("input[name='tempName']").val();
        if (data.elem.checked) {
            $("input[name='xzx']").val(val + data.value + ",");
            $("input[name='tempName']").val(content + $(data.elem).attr("title") + ",");
        } else {
            val = ("," + val).replace("," + data.value + ",", ",").replace(",", "");
            content = ("," + content).replace("," + $(data.elem).attr("title") + ",", ",").replace(",", "");
            $("input[name='xzx']").val(val);
            $("input[name='tempName']").val(content);
        }
    });
    form.on("submit(go)",function (data) {
        var xzx=$("input[name='xzx']").val();
        if(""==xzx){
            layer.msg('请选择借用时间！', {icon: 5});
            return false;
        }
    });
    var index = layedit.build("area", {
        tool: [
            'strong' //加粗
            , 'italic' //斜体
            , '|' //分割线
            , 'left' //左对齐
            , 'center' //居中对齐
            , 'right' //右对齐
        ]
    });
});